<template>
	<view class="bar">
		<uni-nav-bar height="3rem" :border="false" color="#fff" backgroundColor="#18171E" :left-icon="leftIcon"
			:leftText="leftText" :right-icon="rightIcon" :rightText="rightText" :title="title" @clickRight="clickRight"
			@clickLeft="back" >
			<slot name="number"></slot>
			<slot name="title"></slot>
			</uni-nav-bar>
			
	</view>

</template>
<script>
</script>
<script setup>
	const emit = defineEmits(['clickRight'])
	const props = defineProps({
		leftIcon: {
			type: String,
			default: ''
		},
		leftText: {
			type: String,
			default: ''
		},
		title: {
			type: String,
			default: ''
		},
		rightIcon: {
			type: String,
			default: ''
		},
		rightText: {
			type: String,
			default: ''
		},
		cusBack: {
			type: Boolean,
			default: false
		}
	})
	const back = () => {
		if (props.cusBack) {
			this.$emit('back')
		} else {
			let pages = getCurrentPages(); // 当前页面
			let beforePage = pages[pages.length - 2] // 上一页
			uni.navigateBack({
				animationType: 'fade-out',
				success: (event) => {
					// beforePage.$vm.getData() // 执行上一页的onLoad方法
				}
			})
			// // #ifdef H5
			//  history.back();
			// // #endif
			
		}
	}
	const clickRight = () => {
		emit('clickRight')
	}
</script>

<style lang="scss" scoped>
	.bar {
		padding-top: 2rem;
		background-color: #18171E;
		height: 80rpx;
		position: fixed;
		top: 0;
		width: 100%;
		z-index: 999;
	}
	.uniui-chatboxes-filled{
		zoom: 1.5;
	}
</style>